import 'package:flutter/material.dart';
import 'package:hkzf/widgets/common_image.dart';
import 'index_recommend_data.dart';
import 'index_recommend_item_widget.dart';

class IndexRecommend extends StatelessWidget {
  final List<IndexRecommendItem> recommendItemList;
  const IndexRecommend({Key key, this.recommendItemList = RecommendItemList})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(color: Color(0x08000000)),
      child: Column(
        children: [
          Padding(
            padding: const EdgeInsets.all(10.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  '房屋推荐',
                  style: TextStyle(fontWeight: FontWeight.bold),
                ),
                Text(
                  '更多',
                  style: TextStyle(color: Colors.black54),
                )
              ],
            ),
          ),
          Wrap(
            spacing: 10,
            runSpacing: 10,
            children: recommendItemList.map((e) {
              return Container(
                decoration: BoxDecoration(color: Colors.white),
                width: (MediaQuery.of(context).size.width - 10 * 3) / 2,
                child: IndexRecommondItemWidget(data: e),
              );
            }).toList(),
          ),
        ],
      ),
    );
  }
}
